{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "adce686c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3\n",
      "19 1.7320508234534626\n"
     ]
    }
   ],
   "source": [
    "x=int(input())\n",
    "def calXnew(Xold):\n",
    "    return (x-1) / Xold + Xold / x\n",
    "Xold = 100\n",
    "Xnew = 0\n",
    "i = 1\n",
    "difference = 1\n",
    "\n",
    "while difference > 0.0000001:\n",
    "    Xnew = calXnew(Xold)\n",
    "    difference = abs(Xnew - Xold)\n",
    "    Xold = Xnew\n",
    "    i += 1\n",
    "\n",
    "print(i, Xnew)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b188d300",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
